package com.niodata.dp.monitor.common.util;

import java.io.PrintWriter;
import java.io.StringWriter;

/**
 * Created by zhangtianyu on 2017/7/5.
 */
public class ThrowableUtil {

  public static String getErrorDetailFromThrowable(Throwable e) {
    try {
      StringWriter sw = new StringWriter();
      PrintWriter pw = new PrintWriter(sw);
      e.printStackTrace(pw);
      return "\r\n" + sw.toString() + "\r\n";
    } catch (Exception e2) {
      return "fail to getErrorDetailFromException";
    }
  }

}
